package com.yuanfeng.goods.controller;


import com.yuanfeng.commoms.annnotation.Log;
import com.yuanfeng.commoms.dto.base.DealerGoodsUserInfoDTO;
import com.yuanfeng.commoms.dto.goods.*;
import com.yuanfeng.commoms.dto.order.WapGoodsSaleSumDTO;
import com.yuanfeng.commoms.dto.shop.ShopIndexDTO;
import com.yuanfeng.commoms.exception.BizCodeEnume;
import com.yuanfeng.commoms.util.ResponseResult;
import com.yuanfeng.commoms.vo.goods.GdsBaseDetailResultVO;
import com.yuanfeng.goods.dto.*;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
 * @ClassName GoodsCommonController
 * @Description 商品表
 * @Author cyp
 * @Date 2023-05-25 09:16:26
 * @Version 1.0
 **/
@RestController
@RequestMapping("/goods/common")
public class GoodsCommonController extends BaseController {

    /**
     * 根据商品id查询详情
     *
     * @param param
     * @return
     */
    @PostMapping("/query/detail")
    public ResponseResult queryGoodsDetail(@RequestBody GoodsDetailsDTO param) {
        ResponseResult result = goodsCommonService.queryGoodsDetail(param);
        return result;
    }

    /**
     * 详情页的猜你喜欢
     *
     * @param param
     * @return
     */
    @PostMapping("/guess/like/query")
    public ResponseResult queryGuessLikeQuery(@RequestBody WepGuessLikeGoodsParamDTO param) {
        ResponseResult result = goodsCommonService.queryGuessLikeQuery(param);
        return result;
    }

    /**
     * 根据commonid查询详情介绍
     *
     * @param commonsId
     * @return
     */
    @GetMapping("/desc/query")
    public ResponseResult queryGdsDetailDesc(@RequestParam("commonsId") Integer commonsId) {
        ResponseResult result = goodsCommonService.queryGdsDetailDesc(commonsId);
        return result;
    }

    /**
     * 推荐商品
     *
     * @param param
     * @return
     */
    @PostMapping("/recommend/goods/query")
    public ResponseResult queryRecommendGoods(@RequestBody WebIndexRecommendQueryParamDTO param) {
        ResponseResult result = goodsCommonService.queryRecommendGoods(param);
        return result;
    }


    /**
     * 查询商品状态及库存
     *
     * @param commonId
     * @return
     */
    @PostMapping("/queryGoodsStartStock")
    public List<GdsBaseDetailResultVO> queryGoodsStartStock(@RequestParam("commonId") Integer commonId) {
        List<GdsBaseDetailResultVO> gdsBaseDetailResultVOS = goodsCommonService.queryGoodsStartStock(commonId);
        return gdsBaseDetailResultVOS;
    }

    /**
     * 修改商品库存
     *
     * @param wapGood
     * @return
     */
    @PostMapping("/update/goodsStock")
    public ResponseResult updateGoodsStock(@RequestBody List<WapGoodsSaleSumDTO> wapGood) {
        ResponseResult result = goodsCommonService.updateGoodsStock(wapGood);
        return result;
    }

    /**
     * 修改商品销量
     *
     * @param wapGood
     * @return
     */
    @PostMapping("/update/goodsSalenum")
    public ResponseResult updateGoodsSalenum(@RequestBody List<WapGoodsSaleSumDTO> wapGood) {
        ResponseResult result = goodsCommonService.updateGoodsSalenum(wapGood);
        return result;
    }

    /**
     * 查询当前商品商品的 售卖区域规则
     *
     * @param goodsIds
     * @return
     */
    @PostMapping("/selectTransportAreaId")
    public List<Integer> selectTransportAreaId(@RequestBody List<Integer> goodsIds) {
        List<Integer> integers = goodsCommonService.selectTransportAreaId(goodsIds);
        return integers;
    }

    /**
     * 更新商品收藏量  feign
     */
    @PostMapping("/update/goods/collect")
    public ResponseResult updateGoodsCollect(@RequestBody Map<String, String> paraMap) {
        ResponseResult result = goodsCommonService.updateGoodsCollect(paraMap);
        return result;
    }

    /**
     * 根据goods_id查询积分商品的价格和所需的积分
     */
    @PostMapping("/integralGoods/query")
    public ResponseResult queryIntegralGoodsBygoodsId(@RequestBody Map<String, Object> param) {
        ResponseResult result = goodsCommonService.queryIntegralGoodsBygoodsId(param);
        return result;
    }

    /**
     * 判断当前商品是否是是 plus 商品 feign
     */
    @PostMapping("/queryGoodsIsPlus")
    public Integer queryGoodsIsPlus(@RequestParam Integer commonId) {
        Integer integer = goodsCommonService.queryGoodsIsPlus(commonId);
        return integer;
    }

    /**
     * 根据商家的商品id 查询供应商的商品价格  feign
     */
    @PostMapping("/querySupplierGoodsPrice")
    ResponseResult querySupplierGoodsPrice(@RequestBody Map<String, Object> param) {
        ResponseResult result = goodsCommonService.querySupplierGoodsPrice(param);
        return result;
    }

    /**
     * 判断当前商品是否是 虚拟商品
     */
    @PostMapping("/queryVirtualgoods")
    ResponseResult queryVirtualgoods(@RequestBody Map<String, String> param) {
        ResponseResult result = goodsCommonService.queryVirtualgoods(param);
        return result;
    }

    /**
     * 更新商品销量和库存
     *
     * @return
     */
    @PostMapping("/update/salesumStock")
    public ResponseResult updateSaleSum(@RequestBody Map<String, String> param) {
        ResponseResult result = goodsCommonService.updateSaleAndStock(param.get("saleSum"));
        return result;
    }

    /**
     * 根据商品规格查询商品
     */
    @PostMapping("/spec/queryNew")
    public ResponseResult queryGoodsSpec(@RequestBody GoodsDetailsDTO param) {
        ResponseResult result = goodsCommonService.queryGoodsSpec(param);
        return result;
    }

    /**
     * 包装清单
     */
    @GetMapping("/packing/list/query")
    public ResponseResult queryPackingList(@RequestParam Integer commonId) {
        ResponseResult result = goodsCommonService.queryPackingList(commonId);
        return result;
    }

    /**
     * 售后服务
     *
     * @param commonId
     * @return
     */
    @GetMapping("/common/service/query")
    public ResponseResult queryCommonService(@RequestParam Integer commonId) {
        ResponseResult result = goodsCommonService.queryCommonService(commonId);
        return result;
    }

    /**
     * 积分商品列表 pc
     *
     * @param param
     * @return
     */
    @PostMapping("integral/query/filter")
    public ResponseResult queryIntegralGoodsListFilter(@RequestBody(required = false) ListPageQueryParamDTO param) {
        ResponseResult result = goodsCommonService.queryIntegralGoodsListFilter(param);
        return result;
    }

    /**
     * 查询规格值数据
     */
    @PostMapping("/shop/goodsOrderParam/{goodsId}")
    public ResponseResult goodsOrderParam(@PathVariable("goodsId") String goodsId) {
        ResponseResult result = goodsCommonService.goodsOrderParam(goodsId);
        return result;
    }

    /**
     * 查询店铺首页
     *
     * @param param
     * @return
     */
    @PostMapping("/shopIndex/query")
    public ResponseResult queryShopIndex(@RequestBody ShopIndexDTO param) {
        ResponseResult result = goodsCommonService.queryShopIndex(param);
        return result;
    }

    /**
     * 根据commonid获取商品详情
     *
     * @param commonId
     * @return
     */
    @GetMapping("/getDetailByCommonId")
    public ResponseResult getDetailByCommonId(@RequestParam("commonId") Integer commonId) {
        ResponseResult result = goodsCommonService.getDetailByCommonId(commonId);
        return result;
    }


    /**
     * 根据商品id修改收藏数
     *
     * @param commonId
     * @return
     */
    @GetMapping("/updateCommonCollect")
    public ResponseResult updateCommonCollect(@RequestParam("goodId") String commonId) {
        ResponseResult result = goodsCommonService.updateCommonCollect(commonId);
        return result;
    }

    /**
     * 取消下单时，增加库存
     *
     * @param param
     * @return
     */
    @PostMapping("/update/stock/reduce")
    public ResponseResult updateStockReduce(@RequestBody WapGoodsSaleSumDTO param) {
        ResponseResult result = goodsCommonService.updateStockReduce(param);
        return result;
    }

    /**
     * 更新商品评论数
     *
     * @param map
     * @return
     */
    @PostMapping("/updateCommentCount")
    public ResponseResult updateCommentCount(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.updateCommentCount(map);
        return result;
    }

    /**
     * 查询商品数据
     *
     * @param param
     * @return
     */
    @PostMapping("/salesum/query")
    public ResponseResult queryByGoodsSalesum(@RequestBody UserTokenBeanDTO param) {
        ResponseResult result = goodsCommonService.queryByGoodsSalesum(param);
        return result;
    }

    /**
     * 查询出售中的商品 goodsName不传，查询店铺所有   goods
     *
     * @param param
     * @return
     */
    @PostMapping("/gdsname/query")
    public ResponseResult queryByGoodsName(@RequestBody ManageGdsNameQueryDTO param) {
        ResponseResult result = goodsCommonService.queryByGoodsName(param);
        return result;
    }

    /**
     * 根据commonId删除商品
     *
     * @param param
     * @return
     */
    @PostMapping("/commonId/delete")
    @Log("根据commonId删除商品")
    public ResponseResult deleteByCommonId(@RequestBody ManageCommonIdsDTO param) {
        ResponseResult result = goodsCommonService.deleteByCommonId(param);
        return result;
    }


    /**
     * 根据commonId查询商品锁状态
     *
     * @param param
     * @return
     */
    @PostMapping("/query/lock/status")
    public ResponseResult queryGoodsLockedStatus(@RequestBody GoodsDetailsDTO param) {
        ResponseResult result = goodsCommonService.queryGoodsLockedStatus(param);
        return  result;
    }

    /**
     * plus 商品推荐
     */
    @RequestMapping("/selectPlusGoods")
    public ResponseResult selectPlusgoods() {
        ResponseResult selectplusgoods = goodsCommonService.selectplusgoods();
        return selectplusgoods;
    }

    /**
     * 查看放入仓库的商品
     *
     * @param param
     * @return
     */
    @PostMapping("/storeHouse/query")
    public ResponseResult queryStoreHouse(@RequestBody ManageGdsNameQueryDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryStoreHouse(param);
        return result;
    }

    /**
     * 查询等待审核的商品
     *
     * @param param
     * @return
     */
    @PostMapping("/verify/query")
    public ResponseResult queryVerifyGoods(@RequestBody ManageGdsNameQueryDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryVerifyGoods(param);
        return result;
    }

    /**
     * 查询审核失败的商品
     *
     * @param param
     * @return
     */
    @PostMapping("/verify/fail/query")
    public ResponseResult queryVerifyFailGoods(@RequestBody ManageGdsNameQueryDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryVerifyFailGoods(param);
        return result;
    }


    /**
     * 违规的商品
     *
     * @param param
     * @return
     */
    @PostMapping("/violations/query")
    public ResponseResult queryViolationsGoods(@RequestBody ManageGdsNameQueryDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryViolationsGoods(param);
        return result;
    }


    /**
     * 查询运费模板下所有商品
     *
     * @param param
     * @return
     */
    @PostMapping("/by/template/id")
    public ResponseResult queryGoodsByTemplateId(@RequestBody TransportTemplateDetailDeleteDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryGoodsByTemplateId(param);
        return result;
    }

    /**
     * 查询售卖区域id下所有商品
     *
     * @param param
     * @return
     */
    @PostMapping("/by/transport/area/id")
    public ResponseResult queryGoodsByTransportAreaId(@RequestBody TransportTemplateDetailDeleteDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryGoodsByTransportAreaId(param);
        return result;
    }

    /**
     * 修改商品是否加入促销 feign
     *
     * @param commonIdList
     */
    @PostMapping("/update/is/xian")
    public void updateCommonIsXian2(@RequestBody List<Integer> commonIdList) {
        goodsCommonService.updateCommonIsXian2(commonIdList);
    }


    /**
     * 修改商品是否加入促销 feign
     *
     * @param param
     */
    @PostMapping("/update/is/xian/byCommonId")
    public void updateCommonIsXian(@RequestBody Map<String, Object> param) {
        goodsCommonService.updateCommonIsXian(param);
    }

    /**
     * 查询非活动商品
     *
     * @param param
     * @return
     */
    @PostMapping("/goods/query/list")
    public ResponseResult queryGoodsList(@RequestBody GoodsListQueryDTO param) {
        ResponseResult result = goodsCommonService.queryGoodsList(param);
        return result;
    }

    /**
     * 查询出售中的商品 goodsName不传，查询店铺所有   activityGoods
     *
     * @param param
     * @return
     */
    @PostMapping("/activityGoods/query")
    public ResponseResult queryactivityGoods(@RequestBody ManageGdsNameQueryDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryactivityGoods(param);
        return result;
    }

    /**
     * 查询装修空间 所有商品
     *
     * @param param
     * @return
     */
    @PostMapping("/modularization/queryGoodsAll")
    public ResponseResult queryManageSpaceAllGoods(@RequestBody PlatFormAllGoodsQueryDTO param) {
        ResponseResult result = goodsCommonService.queryManageSpaceAllGoods(param);
        return result;
    }

    /**
     * 查询商品数量
     *
     * @param map
     * @return
     */
    @PostMapping("/query/goodsCount")
    public ResponseResult goodsCount(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.goodsCount(map);
        return result;
    }

    /**
     * 查询今日商品数量
     *
     * @param map
     * @return
     */
    @PostMapping("/query/todayNumber")
    public ResponseResult goodsTodayNumber(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.goodsTodayNumber(map);
        return result;
    }

    /**
     * 查询所有商品
     *
     * @param param
     * @return
     */
    @PostMapping("/all/goods")
    public ResponseResult queryAllGoods(@RequestBody PlatFormAllGoodsDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryAllGoods(param);
        return result;
    }

    /**
     * 商品按月分组统计
     */
    @RequestMapping("/query/byMonth")
    public ResponseResult queryByMonth(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.queryByMonth(map);
        return result;
    }

    /**
     * 商品一键上架 同步商品
     *
     * @param goodsUserInfo
     * @return
     */
    @RequestMapping("/putAway")
    public ResponseResult putAway(@RequestBody DealerGoodsUserInfoDTO goodsUserInfo) {
        ResponseResult result = goodsCommonService.putAway(goodsUserInfo);
        return result;
    }
    /**
     * 供应商商品立即购买
     * @param map
     * @return
     */
    @RequestMapping("/dealer")
    public ResponseResult dealer(@RequestBody Map<String,String> map){
        ResponseResult result = goodsCommonService.dealer(map);
        return result;
    }
    /**
     * 查询经销商品
     *
     * @param param
     * @return
     */
    @PostMapping("/query/dealerGoods")
    public ResponseResult queryDealerGoods(@RequestBody ManageGdsNameQueryDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryDealerGoods(param);
        return result;
    }

    /**
     * 批量更新或新增商品角标
     *
     * @return
     */
    @PostMapping("/batchUpdateCorner")
    public ResponseResult batchUpdateCorner(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.batchUpdateCorner(map);
        return result;
    }

    /**
     * 删除商品角标
     *
     * @return
     */
    @PostMapping("/delete/corner")
    public ResponseResult deleteCornerMarker(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.deleteCornerMarker(map);
        return result;
    }

    /**
     * 积分商品编辑
     *
     * @param param
     * @return
     */
    @PostMapping("/updateIntegralGoods")
    public ResponseResult updateIntegralGoods(@RequestBody IntegralCommonDTO param) {
        ResponseResult result = goodsCommonService.updateIntegralGoods(param);
        return result;
    }

    /**
     * 查询商品详情
     *
     * @param map
     * @return
     */
    @PostMapping("/goodsQueryDetail")
    public ResponseResult goodsQueryDetail(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.goodsQueryDetail(map);
        return result;
    }


    /**
     * 积分商品添加
     *
     * @param param
     * @return
     */
    @PostMapping("/addIntegralGoods")
    public ResponseResult addIntegralGoods(@RequestBody ManageGdsCommonPublishDTO param) {
        ResponseResult result = goodsCommonService.addIntegralGoods(param);
        return result;
    }

    /**
     * 优惠券商品列表
     */
    @PostMapping("/query/couponList")
    public ResponseResult queryCouponList(@RequestBody UserVcBaseQueryDTO param) {
        ResponseResult result = goodsCommonService.queryCouponList(param);
        return result;
    }

    /**
     * 红包商品列表
     *
     * @param param
     * @return
     */
    @PostMapping("/query/redPacketList")
    public ResponseResult queryRedPacketList(@RequestBody UserAvailableRedpacketQueryDTO param) {
        ResponseResult result = goodsCommonService.queryRedPacketList(param);
        return result;
    }


    /**
     * 查询商品、店铺、蜂巢审核数
     *
     * @param
     * @return
     */
    @PostMapping("/query/verify/num")
    public ResponseResult queryVerifyNum(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.queryVerifyNum(map);
        return result;
    }

    /**
     * 更新spu商品 除shopId无其他条件
     *
     * @param map
     * @return
     */
    @PostMapping("/update")
    public ResponseResult updateGoodsCommonByMap(@RequestBody Map<String, Object> map) {
        ResponseResult result = goodsCommonService.updateGoodsCommonByMap(map);
        return result;
    }

    /**
     * 根据店铺id查找所有commonId
     *
     * @param shopId
     * @return
     */
    @GetMapping("/query/commonIdListByShopId")
    public List<Integer> queryCommonIdList(@RequestParam("shopId") Integer shopId) {
        List<Integer> result = goodsCommonService.queryCommonIdByShopId(shopId);
        return result;
    }

    /**
     * 更新spu商品状态
     *
     * @param commonParam
     * @return
     */
    @PostMapping("/updateGoodsCommonState")
    public ResponseResult updateCommonState(@RequestBody CommonShopStateDTO commonParam) {
        ResponseResult result = goodsCommonService.updateCommonState(commonParam);
        return result;
    }

    /**
     * 查询所有的积分商品
     *
     * @param param
     * @return
     */
    @PostMapping("/queryIntegralAll")
    public ResponseResult queryIntegralAll(@RequestBody(required = false) ListPageQueryParamDTO param) {
        ResponseResult result = goodsCommonService.queryIntegralAll(param);
        return result;
    }


    /**
     * 平台商品批量 锁定
     *
     * @param param
     * @return
     */
    @PostMapping("/platform/lock/update")
    public ResponseResult platformLockUpdate(@RequestBody PlatFormGoodsStateDTO param) {
        ResponseResult result = goodsCommonService.platformLockUpdate(param);
        return result;
    }


    /**
     * 平台商品批量 屏蔽
     *
     * @param param
     * @return
     */
    @PostMapping("/platform/screen/update")
    public ResponseResult platformScreenUpdate(@RequestBody PlatFormGoodsStateDTO param) {
        ResponseResult result = goodsCommonService.platformScreenUpdate(param);
        return result;
    }


    /**
     * 平台商品批量上、下架  审核
     *
     * @param param
     * @return
     */
    @PostMapping("/platform/violations/update")
    public ResponseResult platformViolationsUpdate(@RequestBody PlatFormGoodsStateDTO param) {
        ResponseResult result = goodsCommonService.platformViolationsUpdate(param);
        return result;
    }


    /**
     * 平台查询商品详情
     *
     * @param param
     * @return
     */
    @PostMapping("/platform/query/detail")
    public ResponseResult platformQueryDetail(@RequestBody ManageGdsNameQueryParamDTO param) {
        ResponseResult result = goodsCommonService.platformQueryDetail(param);
        return result;
    }

    /**
     * 获取门店列表库存信息
     *
     * @param param
     * @return
     */
    @PostMapping("/query/gateCommons")
    public ResponseResult queryGateCommonsList(@RequestBody GateQueryCommonsDTO param) {
        ResponseResult result = goodsCommonService.queryGateCommonsList(param);
        return result;
    }

    /**
     * 查询出售中的商品规格列表
     *
     * @param param
     * @return
     */
    @PostMapping("/query/goodsSpec")
    public ResponseResult queryGoodsSpecList(@RequestBody ManageCommonIdsDTO param) {
        ResponseResult result = goodsCommonService.queryGoodsSpecList(param);
        return result;
    }

    /**
     * 门店设置库存
     *
     * @param param
     * @return
     */
    @PostMapping("/update/inventory")
    public ResponseResult updateGateShopStock(@RequestBody GateUpShopGoodsStockDTO param) {
        ResponseResult result = goodsCommonService.updateGateShopStock(param);
        return result;
    }

    /**
     * 商品分类批量审核
     * @param dto
     * @return
     */
    @PostMapping("/check/batchVerify")
    public ResponseResult checkBatchVerify(@RequestBody DealerGoodsUserInfoDTO dto){
        ResponseResult result=goodsCommonService.checkBatchVerify(dto);
        return result;
    }


    /**
     * 商家经销审核
     * @param dto
     * @return
     */
    @PostMapping("/check/dealer")
    public ResponseResult checkDealer(@RequestBody DealerGoodsUserInfoDTO dto){
        ResponseResult result=goodsCommonService.checkDealer(dto);
        return result;
    }

    /**
     * 查询商家是否是指定供应商的经销商
     * @param dto
     * @return
     */
    @PostMapping("/queryGoodsUser")
    public ResponseResult queryGoodsUser(@RequestBody DealerGoodsUserInfoDTO dto){
        ResponseResult result=goodsCommonService.queryGoodsUser(dto);
        return result;
    }

    /**
     * 商家中心-商品信息查询
     * @param dto
     * @return
     */
    @PostMapping("/business/queryGoodsDetail")
    public ResponseResult queryGoodsDetailByBusiness(@RequestBody ManageCommonIdsDTO dto) {
        ResponseResult result=goodsCommonService.queryGoodsDetailByBusiness(dto);
        return result;
    }

    /**
     * 商家中心-供应商商品列表页
     * @param dto
     * @return
     */
    @PostMapping("/business/queryGoodsList")
    public ResponseResult queryGoodsListByBusiness(@RequestBody WebGoodsListQueryDTO dto) throws IllegalAccessException {
        ResponseResult result=goodsCommonService.queryGoodsListByBusiness(dto);
        return result;
    }

    /**
     * 查询出售中的商品 goodsName不传，查询店铺所有
     *
     * @param
     * @return
     */
    @PostMapping("/live/gdsname/query")
    public ResponseResult livequeryByGoodsName(@RequestBody ManageGdsNameQueryDTO param) {
        ResponseResult result = goodsCommonService.livequeryByGoodsName(param);
        return result;
    }

    /**
     * 判断商品是否可以添加
     * @param param
     * @return
     */
    @PostMapping("/seckill/check/goods")
    public ResponseResult seckillCheckGoods(@RequestBody ManageSeckillBaseUpdateDTO param) {
        ResponseResult result=goodsCommonService.seckillCheckGoods(param);
        return result;
    }
    /**
     * 商品搜索列表
     *
     * @param param
     * @return
     */
    @PostMapping("/query/filter")
    public ResponseResult shopListQueryByShopFilter(@RequestBody(required = false) ListPageQueryParamDTO param) {
        ResponseResult result = goodsCommonService.shopListQueryByShopFilter(param);
        return result;
    }
    /**
     * 添加plus商品
     * @param map
     * @return
     */
    @PostMapping("/updatePlusGoods")
    public ResponseResult updatePlusGoods(@RequestBody Map<String, Object> map){
        ResponseResult result=goodsCommonService.updatePlusGoods(map);
        return result;
    }


    /**
     * 查询plus商品信息
     * @param map
     * @return
     */
    @PostMapping("/selecPlustGoodsByPage")
    public ResponseResult selecPlustGoodsByPage(@RequestBody Map<String, Object> map){
        ResponseResult result=goodsCommonService.selecPlustGoodsByPage(map);
        return result;
    }

    /**
     * 删除plus商品
     * @param map
     * @return
     */
    @PostMapping("/deletePlusGoods")
    public ResponseResult deletePlusGoods(@RequestBody Map<String, Object> map){
        ResponseResult result=goodsCommonService.deletePlusGoods(map);
        return result;
    }

    /**
     * 查询赠品
     *
     * @param param
     * @return
     */
    @PostMapping("/query/giftList")
    public ResponseResult queryGiveawayList(@RequestBody ManjianzengzheListQueryDTO param) throws IllegalAccessException {
        ResponseResult result=goodsCommonService.queryGiveawayList(param);
        return result;
    }

    /**
     * 判断商品是否可以添加
     * @param param
     * @return
     */
    @PostMapping("/discount/check/goods")
    public ResponseResult discountCheckGoods(@RequestBody DiscountBaseAddParamDTO param) {
        ResponseResult result=goodsCommonService.discountCheckGoods(param);
        return result;
    }


    /**
     * 查询商品列表 暂不用
     *
     * @param param
     * @return
     */
    @PostMapping("/pingtuan/goods/query/list")
    public ResponseResult queryGoodsList(@RequestBody Map<String, Object> param) {
        ResponseResult result=goodsCommonService.queryGoodsListByPintuan(param);
        return result;
    }

    /**
     * 查询商家同步供应商的商品 但未修改过价格的
     */
    @PostMapping("/queryIsPriceUpdate")
    public ResponseResult queryIsPriceUpdate(@RequestBody ManageGdsNameQueryDTO param) throws IllegalAccessException {
        ResponseResult result=goodsCommonService.queryIsPriceUpdate(param);
        return result;
    }

    /**
     * 待发布的商品
     *
     * @param param
     * @return
     */
    @PostMapping("/wait/release/query")
    public ResponseResult queryWaitRelease(@RequestBody ManageGdsNameQueryDTO param) throws IllegalAccessException {
        ResponseResult result=goodsCommonService.queryWaitRelease(param);
        return result;
    }


    /**
     * 商品上架
     *
     * @param param
     * @return
     */
    @PostMapping("/online")
    public ResponseResult setGoodsOnline(@RequestBody ManageCommonIdsDTO param) {
        ResponseResult result=goodsCommonService.setGoodsOnline(param);
        return result;
    }

    /**
     * 校验商品名称是否重复
     *
     * @param param
     * @return
     */
    @PostMapping("/check/goods/name")
    public ResponseResult checkGoodsName(@RequestBody CheckNameQueryParamDTO param) {
        ResponseResult result = goodsCommonService.checkGoodsName(param);
        return result;
    }


    /**
     * 校验店铺规格下是否有商品
     *
     * @param param
     * @return
     */
    @PostMapping("/spec/query")
    public ResponseResult checkGoodsBySpecId(@RequestBody Map<String, Object> param) {
        ResponseResult result=goodsCommonService.checkGoodsBySpecId(param);
        return result;
    }


    /**
     * 删除店铺规格
     *
     * @param param
     * @return
     */
    @PostMapping("/delete/specsValue")
    public ResponseResult deleteBySpecId(@RequestBody Map<String, Object> param) {
        ResponseResult result=goodsCommonService.deleteBySpecId(param);
        return result;

    }


    /**
     * 商品下架
     *
     * @param param
     * @return
     */
    @PostMapping("/offline")
    public ResponseResult setGoodsOffline(@RequestBody ManageCommonIdsDTO param) {
        ResponseResult result=goodsCommonService.setGoodsOffline(param);
        return result;
    }

    /**
     * 查询门店商品
     * @param param
     * @return
     */
    @PostMapping("/h5/queryGoods")
    public ResponseResult queryGoods(@RequestBody Map<String,Object> param) {
        ResponseResult result = goodsCommonService.queryGoods(param);
        return result;
    }

    /**
     * 根据条件筛选
     *
     * @param param
     * @return
     */
    @PostMapping("/h5/filter/query")
    public ResponseResult queryByFilter(@RequestBody ShopIndexQueryParamDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryByFilter(param);
        return result;
    }

    /**
     * 查询店铺首页
     *
     * @param param
     * @return
     */
    @PostMapping("/h5/shopindex/query")
    public ResponseResult queryShopIndexquery(@RequestBody ShopIndexQueryParamDTO param) throws IllegalAccessException {
        ResponseResult result = goodsCommonService.queryShopIndexquery(param);
        return result;
    }

    /**
     * 商家端-图片导入传入zip包
     * @param file
     * @return
     */
    @PostMapping("/zipLocalDisk")
    public ResponseResult zipLocalDiskImage(@RequestParam("file") MultipartFile file, @RequestParam("commonList") List<String> commonList) throws IOException {

        byte[] sourceZipFileBytes = null;
        //将zip转换为二进制流
        sourceZipFileBytes = file.getBytes();
        if (sourceZipFileBytes ==null){
            return ResponseResult.fail(0, "导入文件为空！");
        }else {
            ResponseResult result=goodsCommonService.zipLocalDiskImage(sourceZipFileBytes,commonList);
            return result;
        }

    }


    /**
     * 淘宝导入
     * @param file
     * @param token
     * @param transportAreaId
     * @param transportTemplate
     * @return
     * @throws Exception
     */
    @PostMapping("/importGoodsData/file")
    public ResponseResult insertGoodsBatch(@RequestParam("file") MultipartFile file, @RequestParam("token") String token,
                                       @RequestParam("transportAreaId") Integer transportAreaId,
                                       @RequestParam("transportTemplate") Integer transportTemplate) throws Exception {
        ResponseResult result=goodsCommonService.insertGoodsBatch(file,token,transportAreaId,transportTemplate);
        return result;
    }

    /**
     * 批量上架同步供应商商品
     */
    @PostMapping("/updateSupperGoodsStart")
    public ResponseResult updateSupperGoodsStart(@RequestBody Map<String,Object> param) {
        ResponseResult result=goodsCommonService.updateSupperGoodsStart(param);
        return result;
    }
    /**
     * 满赠减少赠品库存增加商品销量
     *
     * @param commonIdList
     * @return
     */
    @PostMapping("/updateGiveawayStock")
    public void updateGiveawayStock(@RequestBody List<Integer> commonIdList) {
        goodsCommonService.updateGiveawayStock(commonIdList);
    }

    /**
     * 查询待发布的商品
     *
     * @param param
     * @return
     */
    @PostMapping("/query/toBeReleased")
    public ResponseResult queryToBeReleased(@RequestBody ManageGdsNameQueryParamDTO param) {
        if (param.getToken() == null) {
            return ResponseResult.fail(BizCodeEnume.TOKEN_IS_NULL);
        } else {
            return goodsCommonService.queryToBeReleased(param);
        }
    }

    /**
     * 定时发布商品--立即发布
     *
     * @param param
     * @return
     */
    @PostMapping("/fixedTimeGoodsPublishNow")
    public ResponseResult fixedTimeGoodsPublishNow(@RequestBody ManageCommonIdsDTO param) {
        return goodsCommonService.fixedTimeGoodsPublishNow(param);
    }

    /**
     * 放入仓库商品--立即审核
     *
     * @param param
     * @return
     */
    @PostMapping("/putIntoWarehouseGoodsReviewingNow")
    public ResponseResult putIntoWarehouseGoodsReviewingNow(@RequestBody ManageCommonIdsDTO param) {
        return goodsCommonService.putIntoWarehouseGoodsReviewingNow(param);
    }

}

